<?php $grid = $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'workflow-grid'.$plusId,
    'dataProvider'=>$model->search($locale),
    'filter'=>$model,
    'selectableRows'=>2,
    'selectionChanged'=>"updateSelectors",
    'columns'=>array(
        array(
            'class'=>'CCheckBoxColumn',
            'value'=>'$data->id',
            'htmlOptions'=>array('width'=>'3%'),
        ),
        'name',
        'url',
        array(
            'name'=>'creation_datetime',
            'value'=>'Yii::app()->getDateFormatter()->formatDateTime(strtotime($data->creation_datetime))',
            'filter'=>false,
            'htmlOptions'=>array(
                'class'=>'datetime-column'
            )
        ),
        array(
            'name'=>'last_update',
            'value'=>'Yii::app()->getDateFormatter()->formatDateTime(strtotime($data->last_update))',
            'filter'=>false,
            'htmlOptions'=>array(
                'class'=>'datetime-column'
            )
        ),
        array(
            'name'=>'type',
            'value'=>'$data->typeText',
            'filter'=>false,
        ),
        array(
            'class'=>'CButtonColumn',
            'template'=>'{update} {delete}',
            'buttons'=>array(
                'delete'=>array(
                    'visible'=>'!in_array($data->type, array(1,2))',
                )
            )
        ),
    ),
)); 

if ($grid->dataProvider->ItemCount) {
    $this->menu[$plusId] = array('label' => 'Delete selected items', 'url'=>$this->createUrl('delete'), 'linkOptions' => array('id'=>'del'.$plusId, 'onclick'=>'return multipleDelete("workflow-grid'.$plusId.'",this.href)'));
}
Yii::app()->clientScript->registerScriptFile(Yii::app()->core->AssetUrl.'/scripts/gridview.js', CClientScript::POS_BEGIN);
?>
